<!DOCTYPE html>
<html lang="en">
<script type="text/javascript">
    var dire = 'user';
    var thumb = 'big_thumb,middle_thumb,small_thumb';
    var fileNumLimit = 1;
</script>
<head>
	<{include file="header.html"}>
	<title>添加视频-<{$user_data['school_name']}>-德安信会计在线教育平台</title>
	<link href="/static/public/webupload/webuploader.css" rel="stylesheet">
    <link href="/static/public/webupload/style.css" rel="stylesheet">
</head>
<body>
<div class="wrap">
	<!--star left-->
	<div class="column">
		<{include file="left_menu.html"}>
	</div>
	<div id="ContMianBox">
		<!--star子栏目-->
		<div class="sub-colum">
            <div class="tit"><{$left_menu_min.menu}></div>
            <ul>
                <{foreach from=$left_menu_min.list item=item}>
                <li <{if $item['url'] == $left_menu_min.curr}>class="curr"<{/if}>><a href="<{$item['url']}>"><{$item['name']}></a></li>
                <{/foreach}>
            </ul>
        </div>
		<!--end子栏目-->
		<!--end left-->
		<div class="container narrow">
			<!--star conter-->
			<div class="cetContent">
					<div class="tit p-lr20">
					    <a class="c-40d064" href="/course/video">视频库</a><em class="p-lr10 c-CCCCCC fs12">/</em><em>发布视频</em>
					</div>
		</div>
<!--star内容区域-->
<div class="mainScroll">
    <div class="mainContainer line-all">
        <!--star tabMainCont-->
        <div class="line-all p20">
                        <input type="hidden" id="token" value="<{$token}>">
                        <form class="layui-form" method="post" action="<{$post_url}>" onsubmi="return false" id="form_add_video_course">
                        <input type="hidden" name="id" value="<{$videos_info.id|default:'0'}>" />
                        <div class="layui-form-item">
                            <div class="layui-inline">
                                <label class="layui-form-label">视频标题</label>
                                <div class="layui-input-block">
                                    <input type="text" value="<{$videos_info.title|default:""}>" name="title" placeholder="请输入标题" lay-verify="required" autocomplete="off" class="layui-input" style="width: 800px;">
                                </div>
                            </div>
                        </div>
                        <!-- <div class="layui-form-item">
                            <label class="layui-form-label">视频封面：</label>
                            <div class="layui-input-block">
                                <div class="p-tb10 line-all oh b-FFFFFF">
                                    <ul class="upload_A uploader-list" id="fileList">
                                        <{if isset($img_url)}>
                                        <{foreach from=$img_url item=item}>
                                        <li id="" class="file-item thumbnail">
                                            <img src="<{$item}>">
                                            <div class="info hide"></div>
                                            <input type="hidden" name="img_url[]" value="<{$item}>">
                                        </li>
                                     <{/foreach}>
                                     <{/if}>
                                        <li>
                                            <div id="filePicker">选择图片</div>
                                        </li>
                                    </ul>
                                 </div>
                                 <{if isset($img_url_err)}>
                            <i class="layui-icon" style="font-size: 30px; color: red">&#x1007;</i>
                            <span class="tip" style=" padding:2px 5px;"><{$img_url_err}></span>
                            <{/if}>
                                <div class="layui-form-mid layui-word-aux">提示：班课图片尺寸建议：400*300(4:3)，最多上传6张，第一张为主图
                                </div>
                            </div>
                        </div> -->
                        <div class="layui-form-item">
                            <label class="layui-form-label">课程分类：</label>
                            <div class="layui-input-inline">
                                <select name="cate_id" lay-verify="required" id="cate_id" placeholder="请选择" lay-filter="cate_id">
                                    <option value="">课程分类</option>
                                    <{foreach from=$cate item=item}>
                                        <option value="<{$item.id}>" <{if $videos_info['cate_id']|default:"" == $item.id}>selected="selected"<{/if}>><{$item.name}></option>
                                    <{/foreach}>
                                </select>
                            </div>
                            <div class="layui-form-mid layui-word-aux"><{if empty($cate)}>还没有课程分类，请<a href="/course/cate_publish" class="c-52a1fa">添加课程分类</a><{/if}></div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">课程科目：</label>
                            <div class="layui-input-inline">
                                <select name="subject_id" lay-verify="required" id="subject" placeholder="请选择" lay-filter="subject">
                                    <option value="">请选择科目</option>
                                    <{if $subject|default:'' != ""}>
                                    <{foreach from = $subject item=item}>
                                    <option <{if $item.id == $videos_info['subject_id'] }>selected="selected"<{/if}> value="<{$item.id}>"><{$item.name}></option>
                                    <{/foreach}>
                                    <{/if}>
                                </select>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">视频封面图</label>
                            <div class="layui-input-block">
                                <div id="uploader2" class="upload_box" style="float:left; width:420px;">
                                    <input type="hidden" id="token" value="<{'VIMG'|get_qiniu_token}>" />
                                    <div class="queueList">
                                        <div id="dndArea2" class="placeholder dndArea">
                                            <div id="filePicker2" class="filePicker"></div>
                                            <p>或将照片拖到这里，最多可上传<script>document.write(fileNumLimit);</script>张图片</p>
                                        </div>
                                    </div>
                                    <div class="statusBar" style="display:none;">
                                        <div class="progress">
                                            <span class="text">0%</span>
                                            <span class="percentage"></span>
                                        </div><div class="info"></div>
                                        <div class="btns">
                                            <div id="filePickerBut2" class="filePickerBut"></div><div class="uploadBtn">开始上传</div>
                                        </div>
                                    </div>
                                    <div class="upload_img_input" input_name='image_url'></div>
                                </div>
                                <{if isset($videos_info['image_url']) AND $videos_info['image_url'] != ''}>
                                    <div class="layui-inline" style="float:left;"><img src="<{$videos_info['image_url']}>" style="max-height:175px;"/></div>
                                <{/if}>
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <label class="layui-form-label">上传视频</label>
                            <div class="layui-input-block">
                                <div id="uploader4" class="upload_box" style="float:left;">
                                    <input type="hidden" id="token" value="<{'VIDEO'|get_qiniu_token}>" />
                                    <div class="queueList">
                                        <div id="dndArea4" class="placeholder dndArea">
                                            <div id="filePicker4" class="filePicker"></div>
                                            <p>或将视频文件拖到这里，最多可上传<script>document.write(fileNumLimit);</script>个视频</p>
                                        </div>
                                    </div>
                                    <div class="statusBar" style="display:none;">
                                        <div class="progress">
                                            <span class="text">0%</span>
                                            <span class="percentage"></span>
                                        </div><div class="info"></div>
                                        <div class="btns">
                                            <div id="filePickerBut4" class="filePickerBut"></div><div class="uploadBtn">开始上传</div>
                                        </div>
                                    </div>
                                    <div class="upload_img_input" input_name='video_url'></div>
                                </div>
                                <{if isset($videos_info['video_url']) AND $videos_info['video_url'] != ''}>
                                    <div class="layui-inline" style="float:left;"><{$videos_info['video_url']}></div>
                                <{/if}>
                            </div>
                            <div class="Validform_checktip oi_ab ab_380px"></div>
                        </div>

                        <div class="layui-form-item layui-form-text">
                            <label class="layui-form-label">视频描述：</label>
                            <div class="layui-input-block">
                                <textarea name="description" placeholder="请输入视频描述" lay-verify="required" class="layui-textarea"><{$videos_info.description|default:""}></textarea>
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <label class="layui-form-label">视频时长</label>
                            <div class="layui-input-block">
                                <input type="text" class="layui-input" name="duration" placeholder="示例格式：01:55:59" value="<{$videos_info.duration|default:""}>" >
                            </div>
                        </div>

                        <div class="layui-input-block">
                            <button class="layui-btn" lay-submit lay-filter="*">立即提交</button>
                            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                        </div>
                    </form>
        <!--end tabMainCont-->
        </div>

    </div>
</div>
<!--end内容区域-->
<{include file="footer.html"}>
<script type="text/javascript" src="/static/public/webupload/upload_for_school.js"></script>
<script>
    $(function() {

        layui.use(['form','layedit','jquery'], function() {
            var form = layui.form();
            var layedit = layui.layedit;
            $ = layui.jquery;
            layedit.build('detail'); //建立编辑器
            //监听提交
            form.on('submit(formDemo)', function(data) {
                layer.msg(JSON.stringify(data.field));
                return false;
            });
            form.on('select(cate_id)', function(data){
                var ii = layer.load();
                var id = data.value;
                $("#course_id").html('<option value="">请选择科目</option>');
                form.render('select');
                $.ajax({
                    type: "POST",
                    url: "/course/get_cate_subject",
                    data: {id:id},
                    dataType: "json",
                    success: function (data) {
                        var ddl = $("#subject");
                        var html ='<option value="">请选择科目</option>';
                        $(data).each(function (key) {
                            html += "<option value='"+data[key].id+"'>"+data[key].name+"</option>";
                        });
                        $("#subject").html(html);
                        form.render('select');
                        layer.close(ii);
                    }
                });
            });  
        });


    })
    
</script>
